473,484 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

invok a button click

Hi,
How can I invoke by code a buttoin click event.

I like to call the function that handles the button click.
I'\ve seen the command RAISEEVENT but I didn't know how to use it ion this
case.
Thanks

Nov 20 '05 #1
4 31516
There are a number of ways to do this.
Most likely the most straight forward way would be to have a subroutine
which performs the desired code you wish to run. Then, you can call this
subroutine either by calling it from the button event or from your other
code.
You dont want to raise the button event, you want to run the code which the
button causes.

Regards

"touf" <to******@hotmail.com> wrote in message
news:Oz*************@tk2msftngp13.phx.gbl...
Hi,
How can I invoke by code a buttoin click event.

I like to call the function that handles the button click.
I'\ve seen the command RAISEEVENT but I didn't know how to use it ion this
case.
Thanks

Nov 20 '05 #2
Hi Touf,
For the most part I've gotta agree with Jerry. Unless you are testing your
button routine what he recommended is ideal. However since you asked I'll go
ahead and tell ya:
If I wanted to click a menu item from a button I'd just put the following
code in a button
mnuOpenGame_Click(sender, e)
so to simulate a button click it's almost identical
btnOpen_Click(sender, e).
Cheers,
Christian Blackburn

"Jerry" <Je*********@yahoo.com> wrote in message
news:Os**************@TK2MSFTNGP10.phx.gbl...
There are a number of ways to do this.
Most likely the most straight forward way would be to have a subroutine
which performs the desired code you wish to run. Then, you can call this
subroutine either by calling it from the button event or from your other
code.
You dont want to raise the button event, you want to run the code which the button causes.

Regards

"touf" <to******@hotmail.com> wrote in message
news:Oz*************@tk2msftngp13.phx.gbl...
Hi,
How can I invoke by code a buttoin click event.

I like to call the function that handles the button click.
I'\ve seen the command RAISEEVENT but I didn't know how to use it ion this case.
Thanks


Nov 20 '05 #3
"Christian Blackburn" <Christian@Damn@Sp**@Hotmail.com> schrieb
Hi Touf,
For the most part I've gotta agree with Jerry. Unless you are
testing your button routine what he recommended is ideal. However
since you asked I'll go ahead and tell ya:
If I wanted to click a menu item from a button I'd just put the
following code in a button
mnuOpenGame_Click(sender, e)
so to simulate a button click it's almost identical
btnOpen_Click(sender, e).


Apart from the fact - that you are of course aware of - that's bad design
because the menu has not been clicked. Further more, a menu has a
PerformClick method (mnuOpenGame.PerformClick).
--
Armin

Nov 20 '05 #4
Hello,

"touf" <to******@hotmail.com> schrieb:
How can I invoke by code a buttoin click event.

I like to call the function that handles the button click.
I'\ve seen the command RAISEEVENT but I didn't know
how to use it ion this


'RaiseEvent' doesn't work here. Call the button's 'PerformClick' method.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2830
by: Michael Johnson Jr. | last post by:
I am trying to handle a button click event, which updates a web control table with data. The button is dynamically created in the table itself. When I call updateTable() in the Page_Load the new...
4
4007
by: Mark Lingen | last post by:
I've found a problem with postback event handling and webcontrol buttons. Try out the following code in an ASP.Net project and you will see. Create a web project in VB.Net and drop this code...
11
13843
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
3
8703
by: Imran Aziz | last post by:
Hello All, I have a search text and button that post data and my button handler filters the repeater control. However when the button is clicked the first time. The page_load event is being called...
7
41713
by: code100579 | last post by:
Hi there, sorry if this is a really simple question. I need to write code for: If a button is pushed and then one variety of other buttons is pushed then certain options on the program will...
7
6842
by: =?Utf-8?B?bWFydGluMQ==?= | last post by:
Hi, All, I create button in the code ( Dim Button as new Button), not using button web component (means not drap button and drop it ont he webform), after that I try to use button_click event,...
3
21040
by: GauravGupta | last post by:
i want to know that is it posible to call button click event before page load event on post back.... please help me....
1
6957
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
0
2859
by: ADN | last post by:
Hi, I am currently extending the GridView control and would like to add a button to the GridView so that it will automatically render one button at the top of the grid. I have a click event for...
0
6943
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7100
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5399
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4833
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4523
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3041
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3034
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
583
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
228
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.